Completed
Push — master ( 3b8b0c...578b04 )
by Michael
02:39
created

BlockquoteMenuItemDispatcher.js ➔ getMenuItem   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 11
rs 10
1
import { wrapIn } from 'prosemirror-commands';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class BlockquoteMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.blockquote;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            console.log(schema);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
14
            throw new Error('Blockquote is not available in schema!');
15
        }
16
        return new MenuItem({
17
            command: wrapIn(schema.nodes.blockquote),
18
            icon: svgIcon('format-quote-close'),
19
            label: 'Blockquote',
20
        });
21
    }
22
}
23